fix(proxy): populate contribution USD savings#1751
Open
ketpatil77 wants to merge 3 commits into
Open
Conversation
Contributor
PR governanceThis PR follows the template and is marked ready for human review. |
added 2 commits
July 3, 2026 19:27
This reverts commit 5785443.
JerrettDavis
approved these changes
Jul 3, 2026
JerrettDavis
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the contribution USD wiring. The new cache-read estimate follows the existing LiteLLM model resolution pattern, treats missing pricing and non-discounted cache reads as zero, and the Anthropic contribution update now passes both compression and cache savings dollars alongside the existing token counts. Focused tests cover the cache pricing helper; checks are green. This looks ready.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Populate session contribution USD totals for compression and cache reads.
AnthropicHandlerMixinnow records both compression savings and cache-read savings in dollars instead of leaving those fields at0.Closes #1751
Type of Change
Changes Made
headroom/proxy/savings_tracker.py: added_estimate_cache_savings_usd()alongside existing compression-savings helper.headroom/proxy/handlers/anthropic.py: passes computed compression and cache savings USD intoupdate_contribution().tests/test_proxy_cache_savings_usd.py: added regression tests for new cache-savings helper.Testing
pytest)ruff check .)mypy headroom)Test Output
Real Behavior Proof
update_contribution().Review Readiness
Checklist